package com.example.base.demo.controller;

import io.minio.BucketExistsArgs;
import io.minio.MinioClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author TangDan
 * @version 1.0
 * @since 2023/3/16
 */
@RestController
@RequestMapping("/minio")
public class MinioController {

    @Autowired
    MinioClient minioClient;

    @GetMapping("/test")
    public Object test() throws Exception {
        // 调用Minio 客户端查询存储桶是否存在
        return minioClient.bucketExists(BucketExistsArgs.builder().bucket("bucket").build());
    }
}
